<?php namespace App\Api\Http\Middleware;

use Closure;

class ClientParamsInit
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure                 $next
     *
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        //UA
        $user_agent = $request->header('user-agent');
        app('client')->setUserAgent($user_agent);
        //IP
        app('client')->setIp((string)$request->ip());

        return $next($request);
    }

}
